package com.yanxx.codegenerator.reset.impl;

import com.yanxx.codegenerator.reset.ResetStrategy;

import java.time.LocalDateTime;

/**
 * 按天重置策略
 * 每天重置一次流水号
 */
public class DailyResetStrategy implements ResetStrategy {
    
    @Override
    public boolean shouldReset(LocalDateTime lastResetTime, LocalDateTime currentTime) {
        if (lastResetTime == null) {
            return true;
        }
        
        // 如果日期不同，则需要重置
        return !lastResetTime.toLocalDate().equals(currentTime.toLocalDate());
    }
    
    @Override
    public String getType() {
        return "DAILY";
    }
}